﻿/*
* Do Not Remove
* Author: Douglas Branca http://www.linkedin.com/in/douglasbranca
* CodePlex: https://mvcscriptcompression.codeplex.com 
*/

//module pattern as singleton
var CompressionSwitcher = function () {


    return {
        //binds enable disable buttons
        Init: function () {

            $("#EnableCompression").click(function () {
                CompressionSwitcher.EnableCompression();
            });

            $("#DisableCompression").click(function () {
                CompressionSwitcher.DisableCompression();
            });
        },

        // Disable compression
        DisableCompression: function () {
            document.cookie = "UncompressScripts=true;path=/";
            window.location = window.location;
            
        },
        //disable compression
        EnableCompression: function () {

            var date = new Date();
            date.setTime(date.getTime() - 1);
            var temp = date.toUTCString();

            document.cookie = "UncompressScripts=false;path=/;expires=" + temp;
            window.location = window.location;

          
        }

    };


} ();

//initalize the compression switcher on page load
$(document).ready(function () {

    CompressionSwitcher.Init();
});